home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Misc
/
FLM
/
FLM_cat
/
list2flm.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-01
|
1KB
|
63 lines
/*
list2flm (c) 1996-97 Denis Unger
*/
#include <stdio.h>
#include <string.h>
#define BUFFERSIZE 50000
void main(int argc,char *argv[]) {
const char Version[] = "$VER: list2flm 0.20 (" __DATE2__ ")";
FILE *quell,*ziel;
char *buffer;
int read,i,merk;
unsigned char ch;
printf("list2flm (c) 1996 Denis Unger\n\n");
if(argc!=3) {
printf("Syntax: list2flm <source> <destination>\n");
return;
}
buffer = new unsigned char[BUFFERSIZE];
if(!buffer) return;
quell = fopen(argv[1], "r");
ziel = fopen(argv[2], "w");
if(!quell || !ziel) {
printf("Couldn't open source or destination file\n");
if(quell) fclose(quell);
if(ziel) fclose(ziel);
return;
}
read = BUFFERSIZE; merk=0;
while(read == BUFFERSIZE) {
read=fread(buffer,1,BUFFERSIZE,quell);
for(i=0;i<read;i++) {
ch=buffer[i];
if(ch=='/') buffer[i]='\\';
if(ch==':') {
if(merk==0) merk=1;
else if(merk==1) {
buffer[i]='\\'; merk=0;
}
}
}
fwrite(buffer,1,read,ziel);
}
fclose(quell);
fclose(ziel);
delete buffer;
}